<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=
    , initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function Star(name,type,blood,attack){
            this.name = name;
            this.type = type;
            this.blood = blood;
            this.attack = attack;
            this.sing = function(song){
                console.log(song);
            }
        }
       var pl = new Star('霹雳','力量型','500血量','近战');
       console.log(pl.name);
       console.log(pl.type);
       console.log(pl.blood);
       console.log(pl.attack);
       pl.sing('你爱我我爱你');
    </script>
</body>
</html>